import {Component, OnDestroy, OnInit} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AppUrl} from '../../../app.url';
import {Router} from '@angular/router';
import {NzMessageService} from 'ng-zorro-antd';

@Component({
    templateUrl: 'spon.component.html',
    styleUrls: ['./spon.less', '../../_home/home.less']
})


export class SponComponent implements OnInit, OnDestroy {

    private array = [];//右侧滑动的图片
    private supList = [];
    provList = [
        '不限',
        '北京',
        '天津',
        '河北',
        '山西',
        '内蒙古',
        '辽宁',
        '吉林',
        '黑龙江',
        '上海',
        '江苏',
        '浙江',
        '安徽',
        '福建',
        '江西',
        '山东',
        '河南',
        '湖北',
        '湖南',
        '广东',
        '广西',
        '海南',
        '重庆',
        '四川',
        '贵州',
        '云南',
        '西藏',
        '陕西',
        '甘肃',
        '青海',
        '宁夏',
        '新疆',
        '台湾',
        '香港',
        '澳门',
        '海外',
        '全国',
        '其他',
    ];

    styleList = ['不限', '文艺汇演', '体育竞技', '社会实践', '设计开发', '讲座论坛', '迎新招新', '演讲辩论', '创业营销', '晚会典礼', '传单派送',
        '高校推广', '影视音乐', '其他'];

    priceList = ['不限', '500-1000', '1000-1500', '1500-2500', '2500-3500', '3500-5000', '5000-6500', '6500-8000', '8000-10000', '10000-100000', '其他'];


    slides = [
        {
            image: 'assets/img/1.png',
        },
        {
            image: 'assets/img/2.png',
        },
        {
            image: 'assets/img/3.png',
        },
        {
            image: 'assets/img/4.png',
        }
    ];


    preList = [
        {
            image: 'assets/img/1.png', desc: '社团联合会',
        },
        {
            image: 'assets/img/2.png', desc: '社团联合会',
        },
        {
            image: 'assets/img/3.png', desc: '社团联合会',
        },
        {
            image: 'assets/img/4.png', desc: '社团联合会',
        }
    ];

    hotList = [
        {
            text: 'fdfdff社团联合会',
        },
        {
            text: '社团联合会',
        },
        {
            text: '社团联合会',
        },
        {
            text: '社团联合会',
        }
    ];

    constructor(private http: HttpClient, private nzMessage: NzMessageService) {
    }

    private loadMsg;
    ngOnInit() {
     this.loadMsg = this.nzMessage.loading('', {nzDuration: 0}).messageId;
        setTimeout(_ => {
            this.array = ['./assets/img/coffee1.jpg', './assets/img/coffee2.jpg', './assets/img/coffee3.jpg', './assets/img/coffee4.jpg'];
        }, 500);
    }

    ngOnDestroy() {
        this.nzMessage.remove(this.loadMsg);
    }

    private page: any = {
        pageNum: 1,
        pageSize: 10,
        total: 0,
    };
    getPage(pageNum) {
        this.http.post(AppUrl.support.selectListUrl, {
            pageNo: pageNum,
            pageSize: this.page.pageSize
        }).subscribe(data => {
            let temp: any = data;
            if (temp.code == 200) {
                this.nzMessage.remove(this.loadMsg);
                this.page = temp.data;
                this.supList = this.page.list;
            }
        });
    }
}
